This disclosure relates generally to the field of packet processing systems, and more specifically to a programmable multifield packet parser to perform data extraction and inspection of received packets.
Data transferred over a communication channel may be provided in a streaming mode, which is a serial sequence of information. An advantage of streaming data is that the receiver may start processing the content of the data stream before the entire stream is received. Streaming data may include various types of content, such as video, audio, or multimedia content. Streaming enables the data to be played back as soon as it is received, thus reducing the delay at the receiver before the media can be presented to the user.
Streaming data is supported by underlying networks and protocols that are used to transport the data stream. Every datagram, cell, packet, and frame transferred over a network is formatted as a stream of bits. Sequential ordering of information is inherent to protocols used to transfer streaming data over a network, as sequential ordering of streamed information reduces the amount of processing required at the receiver. The beginning of a stream may contain one or multiple fields of information regarding the rest of the stream. For example, the first digit of an internet protocol (IP) datagram may indicate the IP version of the stream.
Sequential ordering enables flexible protocol stack combinations, which allow different sets of computers running different high-level network protocols to share the same physical media. For example, the stacking of transmission control protocol (TCP) over IP protocol may be indicated by the protocol field of the IP header datagram, which is transferred ahead of the payload part of the IP datagram used to embed the TCP datagram. TCP over IP is also referred to as protocol encapsulation because it turns a given network layer into a trucking service that is unaware of the data it carries for the upper layer applications, enabling protocols to be deployed with flexible options. For example, the next header field of an IPv6 datagram may encode a higher layer protocol such as TCP or user datagram protocol (UDP), or may indicate that the next datagram is one of the IPv6 extension headers and that it is carrying some additional options related to the current IP protocol layer.
The receiver may need to extract one or more particular fields, such as header information, from a stream of data as it is received in order to properly process the rest of the data stream according to the correct protocol. This may be achieved by reading the streaming data into a temporary physical buffer, and advancing a stream pointer through the buffer to extract the needed data from its position in the stream. However, advancing a stream pointer through a buffer may be a relatively slow process. Also, because of protocol stacking and protocol encapsulation, the exact numbers of bytes that make up a header stack may not be known before the stream parsing is done. Therefore, an arbitrary number of bytes must be allocated to the header buffer in order to account for both short packets (e.g. a 42 bytes DIX/IPv4/UDP) as well as long packets (e.g. a 206 bytes DIX/IPv6+Destination+Routing+Fragment-extension-headers/TCP). Although main memory may be cheap and abundant in today's computers, it is a scarce resource for a system on a chip (SoC) and similar VLSI devices, in which multiple functions share a limited amount of area and power on the silicon. Because of memory constraints, hardware packet parsers and protocol processors may only process a limited amount of an incoming stream by dedicating a finite number of buffers to the stream data. In general, only the first few tens or hundreds first bytes can be processed, which may corresponds to the minimum size required to hold the protocol stack headers of a frame of some formats of streaming data. However, other formats, such as InfiniBand (IB) or Ethernet, operate with maximum transfer unit (MTU) sizes of multiple kilobytes.
Variable length fields need to be inspected and processed in order to handle various protocols by a packet processing system. For example, an IPv6 header is composed of field sizes that span from 4 bits (e.g., the IP version) up to 128 bits (e.g., the IP source and destination addresses). Although large fields used to be segmented into smaller fields of fixed size, the solution is not practical at multi-gigabit/s data rates because of the dependency between the data rate and the stream processing frequency (processing_frequency=data_rate/field size). The smaller the field size, the higher the processing frequency needs to be. Therefore, processing a 10 Gb/s Ethernet stream on the basis of fixed field sizes of 8 bits has to be performed at a frequency of 1.25 GHz, which is relatively hard to achieve given the number of fields that must be evaluated and processed in every clock cycle. One solution for relaxing the processing frequency is widening the size of the fixed field from 8 to 16, 32 or 64 bits, and to provide some filtering mask mechanism for extracting shorter fields such as the Ethernet type/len (16 bits) or the IP protocol (8 bits). For example, the IP version (4 bits) can be extracted from a fixed field of 16 bits by isolating the appropriate digit with a mask such as 0xF000, 0x0F00, 0x00F0 or 0x000F. However, since most of the network and media protocols are digit- and/or byte-based, the management and the generation of such masks is a relatively complex process.
Packet payload inspection may also need to be performed, in addition to extraction and inspection of information from the packet header. Because payload information is content-dependent, the location and size of the payload information may not be known in advance. As a result, payload inspection is relatively complex to perform as compared to header parsing, as the payload information to be inspected must be searched within the packet.
A stream processing application may be difficult to accelerate by means of parallelization techniques because of intrinsic sequential data representation. For the case of network protocol processing, this means that the beginning of a network frame typically contains one or multiple fields indicating what the rest of the frame is about. For example, the processing of the 5th and 6th bytes of an IP datagram cannot start before the IP version has been identified by processing the first digit of the datagram: bytes 5-6 of IPv4 encode the “IPv4 Fragment Identification”, while bytes 5-6 of IPv6 encode the “IPv6 Payload Length”.